OSCE Pro – Installation & Hosting Guide
======================================

1. Requirements
---------------
- PHP 7.4+ (PHP 8.x recommended)
- MySQL / MariaDB
- Apache (with mod_php) – typical cPanel / shared hosting
- A barcode scanner that acts as a keyboard (most USB scanners)

2. Local XAMPP Setup (already done)
-----------------------------------
1. Copy osce_pro folder to:
   C:\xampp\htdocs\osce_pro\
2. Create database `osce_pro_db` in phpMyAdmin.
3. Run the SQL schema (tables: facilities, users, candidates, forms, form_items, grade_bands, attempts, attempt_items).
4. Ensure config.php has:
   DB_HOST = 'localhost'
   DB_NAME = 'osce_pro_db'
   DB_USER = 'root'
   DB_PASS = ''
5. Visit:
   http://localhost/osce_pro/login.php
   Default login: admin / admin123 (or your own admin credentials).

3. Deploying to Online Hosting (cPanel)
---------------------------------------
Assume you want it at:
   https://yourdomain.com/osce_pro/

A) Create the database
   1. Log in to cPanel.
   2. Open “MySQL® Databases”.
   3. Create a new database, e.g.:
        yourcpaneluser_oscepro
   4. Create a MySQL user, e.g.:
        yourcpaneluser_osceuser
        with a strong password.
   5. Add that user to the database WITH ALL PRIVILEGES.

B) Import the schema and data
   1. Open “phpMyAdmin” in cPanel.
   2. Select the new DB (yourcpaneluser_oscepro).
   3. Use the “Import” tab and upload your local SQL export (or paste the schema SQL + seed admin user).
   4. Confirm tables are created (facilities, users, candidates, forms, etc.).

C) Upload the files
   1. In cPanel, open “File Manager”.
   2. Go to:
        public_html/
   3. Create a folder:
        osce_pro
   4. Upload all files from your local osce_pro folder into this folder
      (config.php, login.php, users.php, facilities.php, etc.).
      You can zip the folder locally and use “Upload” → “Extract” in File Manager.

D) Configure DB settings for hosting
   1. Edit `config.php` in the server osce_pro folder.
   2. Set:
        define('DB_HOST', 'localhost');
        define('DB_NAME', 'yourcpaneluser_oscepro');
        define('DB_USER', 'yourcpaneluser_osceuser');
        define('DB_PASS', 'YOUR_DB_PASSWORD_HERE');
   3. Save the file.

E) Test the site
   1. Visit:
        https://yourdomain.com/osce_pro/login.php
   2. Log in with your admin credentials.
   3. Create facilities, examiners, forms, and candidates as needed.

4. Usage Notes
--------------
- Each candidate is registered with a candidate number and name.
- A unique barcode value is auto-generated (C000001, C000002, etc.).
  You can print these barcodes using any label system that encodes the text.
- On exam day, each station uses:
    grade.php?form_id=XX
  where XX is the ID of the OSCE form.
- Examiner workflow:
    1) Open the station link.
    2) Scan barcode -> candidate is loaded automatically.
    3) Enter scores and comments.
    4) Save attempt.

5. Export & Filters
-------------------
- Super admin or facility users can view and filter attempts at:
    Export Grades
- Filters:
    - Candidate number
    - Candidate name
    - Form (station form)
    - Station name
    - Date range
- The "Download CSV" link exports the filtered data for Excel/SPSS/analysis.

6. User Management
------------------
- Super admin can:
    - Create facilities (Facilities page).
    - Create and edit users/examiners (Users page).
    - Assign examiners to facilities.
    - Activate/deactivate accounts.
    - Reset passwords.

- Any user can change their own password at:
    Change Password

7. Security Tips
----------------
- Change the default admin password immediately on production.
- Use HTTPS (SSL) on your domain for real exams.
- Restrict OSCE Pro URL access by IP or VPN if required by policy.
- Regularly back up the database (attempts, candidates, forms).
COPYRIGHT & OWNERSHIP
--------------------
OSCE Nexus™ is the intellectual property of:

    Khalaf Almazrouei

All system architecture, workflow logic, code structure, grading mechanisms, and interface designs
are protected works. This software may not be copied, distributed, modified, reverse-engineered,
or deployed without explicit written permission from the author.

© Khalaf Almazrouei – All Rights Reserved.
